From: Karl Heuer Date: Sat, 12 Feb 1994 00:12:15 +0000 (+0000) Subject: (gethomedir): Look at LOGNAME before USER. X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~93143 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=1cac1f6f2ff70b7be978cd1c0baade1661f8f93f;p=emacs.git (gethomedir): Look at LOGNAME before USER. --- diff --git a/src/xrdb.c b/src/xrdb.c index 112badf3629..9ab9f87e915 100644 --- a/src/xrdb.c +++ b/src/xrdb.c @@ -288,20 +288,17 @@ magic_file_p (string, string_len, class, escaped_suffix, suffix) static char * gethomedir () { - int uid; struct passwd *pw; char *ptr; char *copy; if ((ptr = getenv ("HOME")) == NULL) { - if ((ptr = getenv ("USER")) != NULL) + if ((ptr = getenv ("LOGNAME")) != NULL + || (ptr = getenv ("USER")) != NULL) pw = getpwnam (ptr); else - { - uid = getuid (); - pw = getpwuid (uid); - } + pw = getpwuid (getuid ()); if (pw) ptr = pw->pw_dir;